<?php
// +----------------------------------------------------------------------
// |自动签收
// +----------------------------------------------------------------------
// |Data:2016-06-29 下午2:31
// +----------------------------------------------------------------------
// |Author: 吕志雄 <870923001@qq.com>
// +----------------------------------------------------------------------
namespace Cli\Model;
class CronOrderModel{

    /**
     * 自动签收(一分钟一次)
     */
    public function sign(){
        $map = array();
        $map['status'] = 4;
        $list = M('order')->where($map)->field('deliver_time,id')->select();
        if($list){
            $config = D('Admin/Base')->getSettingConfig('sign_time');
            $config = $config ? $config : 24;
            foreach($list as $val){
                if(strtotime('+'.$config.' hours',$val['deliver_time']) >= time()){
                    M('order')->where('id='.$val['id'])->setField(array('sign_time'=>time(),'status'=>5));
                }
            }
        }
    }
}
?>